#include<pcap.h>
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<netinet/if_ether.h>

static const unsigned char pkt1[98] = {
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x80, 0xfa, /* .....Q.. */
//0x8c, 0x90, 0xd3, 0xa8, 0x8b, 0x51, 0x80, 0xfa, /* .....Q.. */
//0x08, 0x00, 0x27, 0x14, 0xee, 0x81, 0x80, 0xfa, /* .....Q.. */
//0x54, 0xab, 0x3a, 0x5c, 0xc8, 0xf8, 0x80, 0xfa, /* .....Q.. */
0x5b, 0x35, 0x61, 0x30, 0x88, 0x64, 0x11, 0x00, /* [5a0.d.. */
0x00, 0x01, 0x00, 0x28, 0xc0, 0x23, 0x01, 0x01, /* ...(.#.. */
0x00, 0x26, 0x1a, 0x47, 0x5a, 0x5a, 0x4a, 0x4c, /* .&.GZZJL */
0x41, 0x4e, 0x31, 0x31, 0x36, 0x33, 0x38, 0x38, /* AN116388 */
0x34, 0x35, 0x36, 0x33, 0x40, 0x31, 0x36, 0x39, /* 4563@169 */
0x30, 0x30, 0x2e, 0x67, 0x64, 0x06, 0x31, 0x37, /* 00.gd.17 */
0x34, 0x35, 0x31, 0x32                          /* 4512 */
};
static const unsigned char pkt50[67] = {
0x08, 0x00, 0x27, 0x14, 0xee, 0x81, 0x8c, 0x90, /* ..[5a0.. */
0xd3, 0xa8, 0x8b, 0x51, 0x88, 0x63, 0x11, 0x07, /* ...Q.c.. */
0x00, 0x00, 0x00, 0x2f, 0x01, 0x01, 0x00, 0x00, /* .../.... */
0x01, 0x02, 0x00, 0x0c, 0x42, 0x33, 0x2d, 0x73, /* ....B3-s */
0x2d, 0x67, 0x64, 0x67, 0x7a, 0x2d, 0x54, 0x59, /* -gdgz-TY */
0x01, 0x03, 0x00, 0x03, 0x63, 0x63, 0x65, 0x01, /* ....cce. */
0x04, 0x00, 0x10, 0xc1, 0x13, 0x03, 0xf4, 0x73, /* .......s */
0xab, 0x72, 0x69, 0x00, 0x32, 0x93, 0x50, 0xd9, /* .ri.2.P. */
0x14, 0x89, 0xc7                                /* ... */
};
int main(int argc, char** argv){
	int i;
	char* dev;
	char errbuf[PCAP_ERRBUF_SIZE];
	pcap_t* handle;
	const u_char* packet;
	struct pcap_pkthdr hdr;
	struct ether_header *eptr;
	struct bpf_program fp;
	bpf_u_int32 maskp;
	bpf_u_int32 netp;


	dev=pcap_lookupdev(errbuf);
	pcap_lookupnet(dev, &netp, &maskp, errbuf);
	strcpy(dev, "eth0");
	handle = pcap_open_live(dev, 65535, 1, -1, errbuf);
	if(!handle){
		fprintf(stderr, "Error!\n");
		exit(-1);
	}
	for(int i = 0; i < 1; i++)
		pcap_sendpacket(handle, pkt1, 60);
	return 0;
}
